<!--/**
*区域活跃度2*
*
* @author LWG
* @date 2022/8/7 16:29
* @since 1.0.0
*/-->
<template>



  <!-- 实时访问数据-->
  <!--  分享平台   互助平台  -->

  <div>
    <el-row>

      <el-card>
        <el-button class="btn btnStyle1" @click="button1">分享平台</el-button>
        <el-button class="btn btnStyle1" @click="button2" type="primary" plain>互助平台</el-button>
        <!--        <el-button class="btn btnStyle1" @click="button3">访问次数</el-button>-->

        <div id="help" style="width: 100%; height: 900px"></div>
      </el-card>
    </el-row>

  </div>

</template>

<script>
import * as echarts from "echarts";

export default {
  name: "RealTime2",
  data() {
    return {
      showNum: 1,
      sureDelBox: ' '
    }
  },
  methods: {
    button1() {
      // console.log("分享平台数据")
      this.showNum = 1
      this.$router.push('/data/ActivityOfRegion');
    },
    button2() {
      // console.log("互助平台数据")
      this.showNum = 2
      this.$router.push('/ActivityOfRegion2');
    },
    button3() {
      this.showNum = 3

    }
  },
  mounted(item) {
    var chartDom = document.getElementById('help');
    var myChart = echarts.init(chartDom);
    var option;

    option = {
      legend: {},
      tooltip: {
        trigger: 'axis',
        showContent: false
      },
      //扇形统计图
      dataset: {
        source: [
          //X轴坐标
          ['share', '2012', '2013', '2014', '2015', '2016', '2017'],
          ['学习模块', 56.5, 82.1, 88.7, 70.1, 53.4, 85.1],
          ['失物招领模块', 51.1, 51.4, 55.1, 53.3, 73.8, 68.7],
          ['校园生活模块', 40.1, 62.2, 69.5, 36.4, 45.2, 32.5],
          ['兼职模块', 25.2, 37.1, 41.2, 18, 33.9, 49.1],
          ['校园情模块', 51.5, 87.1, 83.7, 75.1, 58.4, 80.1],
          ['生活模块', 56.1, 56.4, 50.1, 58.3, 78.8, 63.7],
          ['情感模块', 45.1, 67.2, 64.5, 31.4, 40.2, 37.5]

        ]
      },
      xAxis: { type: 'category' },
      yAxis: { gridIndex: 0 },
      grid: { top: '55%' },
      series: [
        //折线
        {
          type: 'line',
          smooth: true,
          seriesLayoutBy: 'row',
          emphasis: { focus: 'series' }
        },
        {
          type: 'line',
          smooth: true,
          seriesLayoutBy: 'row',
          emphasis: { focus: 'series' }
        },
        {
          type: 'line',
          smooth: true,
          seriesLayoutBy: 'row',
          emphasis: { focus: 'series' }
        },
        {
          type: 'line',
          smooth: true,
          seriesLayoutBy: 'row',
          emphasis: { focus: 'series' }
        },
        {
          type: 'line',
          smooth: true,
          seriesLayoutBy: 'row',
          emphasis: { focus: 'series' }
        },
        {
          type: 'line',
          smooth: true,
          seriesLayoutBy: 'row',
          emphasis: { focus: 'series' }
        },
        {
          type: 'line',
          smooth: true,
          seriesLayoutBy: 'row',
          emphasis: { focus: 'series' }
        },
        {
          type: 'pie',
          id: 'pie',
          radius: '30%',
          center: ['50%', '25%'],
          emphasis: {
            focus: 'self'
          },
          //扇形标语显示格式
          label: {
            formatter: '{b}: {@2012} ({d}%)'
          },
          encode: {
            itemName: 'share',
            value: '2012',
            tooltip: '2012'
          }
        }
      ]
    };
    myChart.on('updateAxisPointer', function (event) {
      const xAxisInfo = event.axesInfo[0];
      if (xAxisInfo) {
        const dimension = xAxisInfo.value + 1;
        myChart.setOption({
          series: {
            id: 'pie',
            label: {
              formatter: '{b}: {@[' + dimension + ']} ({d}%)'
            },
            encode: {
              value: dimension,
              tooltip: dimension
            }
          }
        });
      }
    });
    myChart.setOption(option);

  }

}
</script>

<style>
.btnStyle1 {
  width: 120px;
  height: 50px;
  border-radius: 20px;
  font-size: 18px;
  font-weight: bold;
  margin-bottom: 30px;

}
</style>

